<!DOCTYPE html>
<html lang="zh-cn" class="am-touch js cssanimations">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>{$item.title}</title>
    <meta name="keywords" content="{$Think.config.website.name}">
    <meta name="description" content="{$item.title}">
    <link rel="stylesheet" href="__TAOKE__/css/amazeui.min.css">
    <link rel="stylesheet" href="__TAOKE__/css/common.css"> 
    <!--[if (gte IE 9)|!(IE)]><!--> 
    <script src="__TAOKE__/js/jquery.min.js"></script>
    <script src="__TAOKE__/js/amazeui.lazyload.min.js"></script>
    <script src="__TAOKE__/js/base.js"></script>
    <script src="__WECHAT__/vendors/layer/layer.js"></script>
    <!--<![endif]-->
    
    

</head>
<body> 
    <!--头部-->
    
    <!--end头部-->

    <!--内容-->
    
<div class="cxx-main" id="top">
	<!--主体内容-->
    <div class="cxx-top-menu">
        <a href="javascript:void(0);" onclick="$(&#39;.scroll-wrapper&#39;).empty();history.back(-1);" class="cxx-go-back am-margin-top-sm am-margin-left-sm am-fl">
            <i class="am-icon-chevron-left am-text-center am-vertical-align-middle" style="width:35px"></i>
        </a>
        <a href="{:url('wechat/Index/index')}" class="cxx-go-back am-margin-top-sm am-margin-right-sm am-fr">
        <i class="am-icon-home am-text-center am-vertical-align-middle" style="width:35px"></i>
        </a>
    </div>
	<div>
	<ul class="am-gallery am-avg-sm-1 am-gallery-default am-padding-0 am-no-layout">
    	<li class="am-padding-0">
        	<div class="am-gallery-item">
                        <a href="{$item.pic_url}">
                            <img src="{$item.pic_url}" data-am-pureviewed="1">
                        </a>
                    </div>
                </li>
	</ul>
    <div class="cxx-background-white am-padding-xs am-padding-top-sm clear">
    	<div class="cxx-price am-text-sm am-u-sm-6 am-text-right">积分<span class="am-text-xl am-margin-left-xs cxx-text-pink">￥{$item.org_price}</span></div>
        <div class="price ftA rt am-u-sm-6 am-text-left" style=" line-height: 1.6rem;border-left: solid .1rem #E6E4E4;">
                                <span class="cxx-text-aaa" style="font-size: 1.2rem;"><del>￥<em style="font-style: normal;font-size: 1.3rem;">{$item.org_price}</em></del></span><br>
                                <span class="cxx-text-aaa" style="font-size: 1.2rem;"><em style="font-style: normal;font-size: 1.3rem;">{$item.sales}</em>个人购买</span>
       </div>
    </div>
    <div class="am-text-center cxx-background-white am-padding-xs am-padding-bottom-sm cxx-text-black">{$item.title}</div>
    <div class="cxx-background-white am-padding-horizontal-xs am-padding-vertical-sm am-text-sm" style="border-top: .1rem dashed #eeeeee;">
                <i class="cxx-text-pink am-icon-star-o am-padding-horizontal-xs"></i><strong>推荐理由</strong>
                <br>
                <div class="am-margin-top-xs am-margin-left-xs cxx-text-grey">{$item.introduce}</div>
            </div>
      </div>

		<!--图文详情-->
		<div class="am-panel-group am-margin-vertical-sm" style="margin-bottom: 6rem;">
            <div class="am-panel am-padding-horizontal-xs">
                <div class="am-panel-hd am-padding-left-0 am-padding-right-0 am-padding-vertical-xs ">
                    <h4 class="am-panel-title am-collapsed am-text-sm" data-am-collapse="{parent: &#39;#accordion&#39;, target: &#39;#product-details&#39;}" data-goodsid="{$item.item_id}">
                       <i class="cxx-text-pink am-icon-picture-o am-padding-horizontal-xs"></i>商品图文详情<span class="am-text-xs cxx-text-pink">（点击展开）</span>
                        <i class="am-fr am-icon-sm am-icon-angle-right cxx-text-grey" id="change_icon"></i>
                    </h4>
                </div>
                <div id="product-details" class="am-panel-collapse am-collapse" style="height: 0px;">
                    <div class="am-panel-bd am-padding-0" style="border-top: 0">
                        <div class="am-tab-panel am-fade am-in am-active" id="content"></div>
                    </div>
                </div>
            </div>
        </div>
		<!--猜你喜欢的-->
                
        <!--底部导航-->
		<div class="cxx-footer-menu cxx-background-white clear">
            <ul class="am-avg-sm-3">
                <li class="am-text-center">
                	<a href="{:url('wechat/Index/index')}" class="am-padding-vertical-sm am-block cxx-text-grey">
                    	<i class="am-icon-home am-text-center am-vertical-align-middle"></i>
                        <span class="am-text-xs am-text-center am-vertical-align-middle">首页</span>
                     </a>
                 </li>

                  <!--<li class="am-text-center">-->
                                 <!--<a class="cxx-goods-browser am-padding-vertical-sm am-block  cxx-text-white" href="http://cms.chengxuxia.com/m/click/index.html?id=523777649017&amp;couponId=5da99b45dbac4ebebc1cf30bca4efb9c&amp;title=%E5%9F%BA%E7%A1%80%E8%8B%B1%E8%AF%AD%E8%AF%AD%E6%B3%95%E5%A4%A7%E5%85%A8+21%E5%A4%A9%E6%90%9E%E5%AE%9A%E5%85%A8%E9%83%A8%E8%8B%B1%E8%AF%AD%E8%AF%AD%E6%B3%95+%E5%AD%A6%E4%B9%A0%E5%AE%9E%E7%94%A8%E9%9B%B6%E5%9F%BA%E7%A1%80%E8%87%AA%E5%AD%A6%E6%96%B0%E6%80%9D%E7%BB%B4%E5%88%9D%E4%B8%AD%E9%AB%98%E4%B8%AD%E5%A4%A7%E5%AD%A6%E9%80%82%E7%94%A8%E8%8B%B1%E6%96%87%E5%85%A5%E9%97%A8%E6%88%90%E4%BA%BA%E5%9B%9B%E7%BA%A7%E5%88%86%E8%A7%A3%E8%AF%AD%E6%B3%95%E4%B9%A6%E5%AD%A6%E5%88%9D%E7%BA%A7%E8%8B%B1%E8%AF%AD%E7%9A%84%E6%95%99%E6%9D%90&amp;img=https%3A%2F%2Fimg.alicdn.com%2Fimgextra%2Fi4%2F279470743%2FTB2hbVJcnnI8KJjSszbXXb4KFXa_%21%21279470743.jpg&amp;couponPrice=10&amp;discountPrice=9.9&amp;couponUrl=">-->
                                        <!--<i class="am-icon-internet-explorer am-text-center am-vertical-align-middle"></i>-->
                                        <!--<span class="am-text-xs am-text-center am-vertical-align-middle">领券购买</span>-->
                                    <!--</a>-->
                   <!--</li>-->
                   <li class="am-text-center" style="float: right; width: 60%;">
                     <a class="cxx-goods-taokouling goods-select-page am-padding-vertical-sm am-block  cxx-text-white" href="javascript:void(0)" data-id="" data-activityid="" data-title="" data-img="" data-couponprice="" data-discountprice="" data-couponurl="">
                        <i class="am-icon-weixin am-text-center am-vertical-align-middle"></i>
                        <span class="am-text-xs am-text-center am-vertical-align-middle">立即兑换</span>
                     </a>
                   </li>
            </ul>
        </div>

</div>
<!--end内容-->

    <!--end内容-->

    <!--底部-->
    
    
    <!--end底部-->
    <!--返回顶部-->
<div class="am-gotop-fixed am-active" style="bottom:65px;">
         
    <a href="#top" title="">
        <i class="am-gotop-icon am-icon-angle-up am-round" style="line-height:4rem;font-size: 2.4rem;"></i>
    </a>
</div>

    <!--弹出选择-->
    <div class="select-page-html" style="display: none;">
        <link rel="stylesheet" href="__TAOKE__/css/selectPage.css">
        <div class="sku-wrap">
            <div class="header">
                <div class="img-wrap">
                    <img src="{$item.pic_url}">
                </div>

                <div class="main">
                    <div>{$item.title}</div>
                    <div class="price">￥{$item.org_price}积分</div>
                </div>
                <!--<a class="sku-close" aria-label="关闭"></a>-->
            </div>

            <div class="body">
                <ul class="sku-list-wrap">

                </ul>

                <div class="number-wrap">
                    <div class="number-line">
                        <label for="number">购买数量</label>
                        <span class="J_limitTxt limit-txt"></span>
                        <div class="number">
                            <button class="decrease disabled">-</button>
                            <input id="number" type="number" value="1" disabled>
                            <button class="increase">+</button>
                        </div>
                    </div>
                </div>

            </div>

            <div class="footer">
                <a class="ok" href="javascript:void(0)" role="button">立即兑换</a>
            </div>
        </div>
    </div>
    <!--弹出选择-->
<script src="__TAOKE__/js/amazeui.min.js"></script>
<script src="__TAOKE__/js/clipboard.min.js"></script>

<script>
setTimeout(function() {
    window.addEventListener("popstate", function(e) {
        window.location.hash
    }, false)
}, 300);

</script>


<script type="text/javascript">

    var sku_api_url = '{:url('api/Sku/getSku')}';
    var buy_url = '{:url('wechat/Order/pay')}?id={$item.id}';

$(function() {
	$("img.lazy").lazyload();
	$('.am-panel-title').on('click', function() {
		var goodsId = $(this).attr('data-goodsId'),
		    url = 'http://h5api.m.taobao.com/h5/mtop.taobao.detail.getdesc/6.0/?data={"id":"'+ goodsId+'"}';
		$.get(url,{},function(data){
				$('#content').append(data.data.pcDescContent);
		},'jsonp');
	});

	$('.goods-select-page').click(function () {
        layer.open({
            type: 2
            ,content: '加载中'
        });
	    goods_id= '{$item.id}';
	    getSku(goods_id);
    });

	function getSku(id) {
        $.get(sku_api_url,{id:id},function(result){
            result = $.parseJSON(result);
            if(result.code == 200){
                $('.sku-list-wrap').html('');
                var data = result.data;
                var str = '';
                for (var i = 0; i < data.length; i++) {
                    str += '<li><h2>'+data[i].name+'</h2><div class="items" role="radiogroup">';
                    var sku_value = data[i].value;
                    for (var index = 0; index < sku_value.length; index++) {
                        str += '<a role="radio" href="javascript:void(0)" data-value="'+ sku_value[index].sku_id+'" data-skuname="'+sku_value[index].sku_title+'" data-image="" class="sku_items" aria-checked="false">'+sku_value[index].sku_title+'</a>';
                    }
                    str += '</div></li>';
                }
                $('.sku-list-wrap').append(str);
                //console.log(result.data);
                layer.closeAll();
                selectPage();
            }else{
                layer.closeAll();
                window.location.href = buy_url;
            }
        });
    }

    var sku_id='',sku_name = '';
	function selectPage() {
        var content = $('.select-page-html').html();
        layer.open({
            type: 1,
            content: content,
            anim: 'up',
            style: 'position:fixed; bottom:0; left:0; width: 100%; height: 60%; padding:10px 0; border:none;'
        });
    }

    $(document).on('click','.sku_items',function () {
        $(this).siblings().removeClass('checked');
        $(this).addClass('checked');
    });

    $(document).on('click','.ok',function () {
        sku_id='',sku_name = '';
        if(checkSelect()){
            window.location.href = buy_url + '&sku_id=' + sku_id + '&sku_name=' + sku_name;
        }else{
            layer.open({
                content: '商品还有未选择属性'
                ,skin: 'msg'
                ,time: 1.5
            });
        }
    });

    function checkSelect() {
        var totalResult = true;
        $('.layui-m-layercont .items').each(function () {
            var eachResult = 0;
            var target = $(this);
            $(target.children()).each(function () {
                var per_item = $(this);
                if(per_item.hasClass('checked')){
                    eachResult = 1;
                    sku_id += $(this).data('value') + ',,,';
                    sku_name += $(this).data('skuname') + ';';
                    return false; //已经选择，跳出循环
                }
            });
            if(eachResult == 0){
                totalResult = false;
                return false; //存在未选择，跳出循环
            }
        });
        return totalResult;
    }
	
});
</script>  
  

</body></html>